home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-10 | 8.2 KB | 280 lines | [TEXT/MPS ] |
- (*
- File: Events.mod
-
- Contains: Event Manager Interfaces.
-
- Version: Technology: System 7.5
- Package: Universal Interfaces 2.0 in “MPW Latest” on ETO #17
-
- Copyright: © 1984-1995 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs.applelink.apple.com
- AppleLink: APPLE.BUGS
-
- *)
-
- (*$IF UNDEFINED OLDROUTINENAMES*)
- (*$SET OLDROUTINENAMES FALSE*)
- (*$END*)
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE Events;
-
- IMPORT SYSTEM, Types, Quickdraw, OSUtils;
-
- (* $PUSH*)
- (* $ALIGN MAC68K*)
- (* $LibExport+*)
-
- TYPE
- MacOSEventKind* = Types.UInt16;
-
-
- CONST
- nullEvent* = 0;
- mouseDown* = 1;
- mouseUp* = 2;
- keyDown* = 3;
- keyUp* = 4;
- autoKey* = 5;
- updateEvt* = 6;
- diskEvt* = 7;
- activateEvt* = 8;
- osEvt* = 15;
-
-
- TYPE
- MacOSEventMask* = Types.UInt16;
-
-
- CONST
- mDownMask* = $0002; (* mouse button pressed *)
- mUpMask* = $0004; (* mouse button released *)
- keyDownMask* = $0008; (* key pressed *)
- keyUpMask* = $0010; (* key released *)
- autoKeyMask* = $0020; (* key repeatedly held down *)
- updateMask* = $0040; (* window needs updating *)
- diskMask* = $0080; (* disk inserted *)
- activMask* = $0100; (* activate/deactivate window *)
- highLevelEventMask* = $0400; (* high-level events (includes AppleEvents) *)
- osMask* = $8000; (* operating system events (suspend, resume) *)
- everyEvent* = $FFFF; (* all of the above *)
-
- (* event message equates *)
- charCodeMask* = $000000FF;
- keyCodeMask* = $0000FF00;
- adbAddrMask* = $00FF0000;
- osEvtMessageMask* = $FF000000;
- (* OS event messages. Event (sub)code is in the high byte of the message field. *)
- mouseMovedMessage* = $00FA;
- suspendResumeMessage* = $0001;
- resumeFlag* = 1; (* Bit 0 of message indicates resume vs suspend *)
- convertClipboardFlag* = 2; (* Bit 1 in resume message indicates clipboard change *)
-
-
- TYPE
- MacOSEventModifiers* = Types.UInt16;
-
-
- CONST
- (* modifiers *)
- activeFlag* = $0001; (* Bit 0 of modifiers for activateEvt and mouseDown events *)
- btnState* = $0080; (* Bit 7 of low byte is mouse button state *)
- cmdKey* = $0100; (* Bit 0 of high byte *)
- shiftKey* = $0200; (* Bit 1 of high byte *)
- alphaLock* = $0400; (* Bit 2 of high byte *)
- optionKey* = $0800; (* Bit 3 of high byte *)
- controlKey* = $1000; (* Bit 4 of high byte *)
- rightShiftKey* = $2000; (* Bit 5 of high byte *)
- rightOptionKey* = $4000; (* Bit 6 of high byte *)
- rightControlKey* = $8000; (* Bit 7 of high byte *)
-
-
- TYPE
- EventRecord* = RECORD
- what*: MacOSEventKind;
- message*: Types.UInt32;
- when*: Types.UInt32;
- where*: Types.Point;
- modifiers*: MacOSEventModifiers;
- END;
-
- KeyMap* = ARRAY 4 OF LONGINT (*ΔΔ PACKED ARRAY [0..127] OF BOOLEAN*);
-
- EvQEl* = RECORD
- qLink*: OSUtils.QElemPtr;
- qType*: INTEGER;
- evtQWhat*: MacOSEventKind; (* this part is identical to the EventRecord as... *)
- evtQMessage*: Types.UInt32; (* defined above *)
- evtQWhen*: Types.UInt32;
- evtQWhere*: Types.Point;
- evtQModifiers*: MacOSEventModifiers;
- END;
-
- EvQElPtr* = POINTER TO EvQEl;
-
- GetNextEventFilterProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR theEvent: EventRecord; VAR result: BOOLEAN);
- GetNextEventFilterUPP* = Types.UniversalProcPtr;
-
- CONST
- uppGetNextEventFilterProcInfo* = $000000BF; (* SPECIAL_CASE_PROCINFO( kSpecialCaseGNEFilterProc ) *)
-
- PROCEDURE NewGetNextEventFilterProc*(userRoutine: GetNextEventFilterProcPtr): GetNextEventFilterUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE CallGetNextEventFilterProc*(VAR theEvent: EventRecord; VAR result: BOOLEAN; userRoutine: GetNextEventFilterUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL ; (*••*)
- (*To be implemented*: Glue to move parameters according to special case conventions.*)
- (*$END*)
-
- TYPE
- GNEFilterUPP* = GetNextEventFilterUPP;
-
- FKEYProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE ;
- FKEYUPP* = Types.UniversalProcPtr;
-
- CONST
- uppFKEYProcInfo* = $00000000; (* PROCEDURE ; *)
-
- PROCEDURE NewFKEYProc*(userRoutine: FKEYProcPtr): FKEYUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE CallFKEYProc*(userRoutine: FKEYUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
- PROCEDURE GetCaretTime*(): Types.UInt32;
- (*$IF NOT CFMSYSTEMCALLS*)
- INLINE PASCAL $2EB8, $02F4; (* MOVE.l $02F4,(SP) *)
- (*$END*)
-
- PROCEDURE SetEventMask*(value: MacOSEventMask );
- (*$IF NOT CFMSYSTEMCALLS*)
- INLINE PASCAL $31DF, $0144; (* MOVE.w (SP)+,$0144 *)
- (*$END*)
-
- PROCEDURE GetEventMask*(): MacOSEventMask;
- (*$IF NOT CFMSYSTEMCALLS*)
- INLINE PASCAL $3EB8, $0144; (* MOVE.w $0144,(SP) *)
- (*$END*)
-
- PROCEDURE GetEvQHdr*(): OSUtils.QHdrPtr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $2EBC, $0000, $014A;
- (*$END*)
- (* InterfaceLib exports GetEvQHdr, so make GetEventQueue map to that *)
- PROCEDURE GetDblTime*(): Types.UInt32;
- (*$IF NOT CFMSYSTEMCALLS*)
- INLINE PASCAL $2EB8, $02F0; (* MOVE.l $02F0,(SP) *)
- (*$END*)
-
- (* InterfaceLib exports GetDblTime, so make GetDoubleClickTime map to that *)
- PROCEDURE GetNextEvent*(eventMask: MacOSEventMask; VAR theEvent: EventRecord): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A970;
- (*$END*)
- PROCEDURE WaitNextEvent*(eventMask: MacOSEventMask; VAR theEvent: EventRecord; sleep: Types.UInt32; mouseRgn: Quickdraw.RgnHandle): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A860;
- (*$END*)
- PROCEDURE EventAvail*(eventMask: MacOSEventMask; VAR theEvent: EventRecord): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A971;
- (*$END*)
- PROCEDURE GetMouse*(VAR mouseLoc: Types.Point);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A972;
- (*$END*)
- PROCEDURE Button*(): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A974;
- (*$END*)
- PROCEDURE StillDown*(): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A973;
- (*$END*)
- PROCEDURE WaitMouseUp*(): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A977;
- (*$END*)
- PROCEDURE GetKeys*(theKeys: KeyMap);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A976;
- (*$END*)
- PROCEDURE KeyTranslate*(transData: (*ΔΔUNIVΔΔ*) Types.Ptr; keycode: Types.UInt16; VAR state: Types.UInt32): Types.UInt32;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A9C3;
- (*$END*)
- PROCEDURE TickCount*(): Types.UInt32;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A975;
- (*$END*)
- PROCEDURE PostEvent*(eventNum: MacOSEventKind; eventMsg: Types.UInt32): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $201F, $305F, $A02F, $3E80;
- (*$END*)
- PROCEDURE PPostEvent*(eventCode: MacOSEventKind; eventMsg: Types.UInt32; VAR qEl: EvQElPtr): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $225F, $201F, $305F, $A12F, $2288, $3E80;
- (*$END*)
- PROCEDURE OSEventAvail*(mask: MacOSEventMask; VAR theEvent: EventRecord): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $301F, $A030, $5240, $1E80;
- (*$END*)
- PROCEDURE GetOSEvent*(mask: MacOSEventMask; VAR theEvent: EventRecord): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $301F, $A031, $5240, $1E80;
- (*$END*)
- PROCEDURE FlushEvents*(whichMask: MacOSEventMask; stopMask: MacOSEventMask);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $201F, $A032;
- (*$END*)
- PROCEDURE SystemClick*((*CONST*)VAR theEvent: EventRecord; theWindow: Quickdraw.WindowPtr);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A9B3;
- (*$END*)
- PROCEDURE SystemTask*;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A9B4;
- (*$END*)
- PROCEDURE SystemEvent*((*CONST*)VAR theEvent: EventRecord): BOOLEAN;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A9B2;
- (*$END*)
- (*$IF OLDROUTINENAMES *)
-
- CONST
- networkEvt* = 10;
- driverEvt* = 11;
- app1Evt* = 12;
- app2Evt* = 13;
- app3Evt* = 14;
- app4Evt* = 15;
- networkMask* = $0400;
- driverMask* = $0800;
- app1Mask* = $1000;
- app2Mask* = $2000;
- app3Mask* = $4000;
- app4Mask* = $8000;
-
-
- PROCEDURE KeyTrans*(transData: (*ΔΔUNIVΔΔ*) Types.Ptr; keycode: Types.UInt16; VAR state: Types.UInt32): Types.UInt32;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $A9C3;
- (*$END*)
- (*$END*)
-
- (* $ALIGN RESET*)
- (* $POP*)
-
- END Events.
-